<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>json</title>
</head>
<body>

</body>
<script>

    /*json Javascript Simple Object N*/
    var employee={
        name:'Mary',
        dept:{
            name:'HR',
            location:'West'
        },titles:[
            'assitant','hr'
        ]
    }


    var depts = [{
        name:'hr',
        desc:''
    },{
        name:'dev',
        desc:''
    }]

    /**
     * 序列化和反序列化
     *  1.  序列化： 把一个json对象或者数组变成字符串
     *  2. 反序列化: 把一个字符串变成一个json对象或者数组
    * */

/*   var str= JSON.stringify(employee);

   document.write( str.name);
   document.write("<br/>")
    document.write(str);
    document.write("<br/>")


    var strs='{"name":"test"}';
   var json1=  JSON.parse(strs);

    document.write("string：")
    document.write(strs);
    document.write("<br/>")

    document.write("json：")
    document.write(json1.name);
    document.write("<br/>")*/


  document.write("<div>1</div>")
    document.write("<div>2</div>")


</script>
</html>